package com.dc.refactoring._2_在对象之间搬移特性._1_MoveMethod.newObject.methodOne;

import java.util.Random;

public class AccountType {

    /**
     * 是否为高级
     */
    public boolean isPremium() {
        return new Random().nextBoolean();
    }

    public double overdraftCharge(int daysOverdrawn) {
        double result;
        if (isPremium()) {
            result = 10;
            if (daysOverdrawn > 7) {
                result += (daysOverdrawn - 7) * 0.85;
            }
        } else {
            result = daysOverdrawn * 1.75;
        }
        return result;
    }
}
